<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- a.html:&#160; (http://www.domain1.com/a.html) -->
    <iframe
      id="iframe"
      src="http://www.domain2.com/b.html"
      style="display: none"
    ></iframe>
    <script>
      var iframe = document.getElementById("iframe");

      // 向b.html传hash值
      setTimeout(function () {
        iframe.src = iframe.src + "#user=admin";
      }, 1000);

      // 开放给同域c.html的回调方法
      function onCallback(res) {
        alert("data from c.html ---> " + res);
      }
    </script>
  </body>
</html>
